//
// This script is executed by Grails after plugin was installed to project.
// This script is a Gant script so you can use all special variables provided
// by Gant (such as 'baseDir' which points on project base dir). You can
// use 'ant' to access a global instance of AntBuilder
//
// For example you can create directory under project tree:
//
//    ant.mkdir(dir:"${basedir}/grails-app/jobs")
// 

Ant.property(environment: "env")
grailsHome = Ant.antProject.properties."env.GRAILS_HOME"

includeTargets << new File("${grailsHome}/scripts/_GrailsInit.groovy")
checkVersion()


Ant.sequential {

  event("StatusUpdate", ["Installing Glossy Template"])

  mkdir(dir: "${basedir}/src/templates/")
  mkdir(dir: "${basedir}/src/templates/artifacts")
  mkdir(dir: "${basedir}/src/templates/scaffolding")

  // domain template
  copy(todir: "${basedir}/src/templates/") {
    fileset(dir: "${pluginBasedir}/src/templates/") {
    }
  }

  // main layout page with menu
  copy(todir: "${basedir}/grails-app/views/layouts", overwrite: true) {
    fileset(dir: "${pluginBasedir}/grails-app/views/layouts")
  }

  // CSS file
  copy(todir: "${basedir}/web-app/css", overwrite: true) {
    fileset(dir: "${pluginBasedir}/web-app/css")
  }

  // JS file with focus on first control
  copy(todir: "${basedir}/web-app/js", overwrite: true) {
    fileset(dir: "${pluginBasedir}/web-app/js")
  }

  copy(todir: "${basedir}/grails-app/i18n/") {
    fileset(dir: "${pluginBasedir}/grails-app/i18n/") {
    }
  }

}

event("StatusFinal", ["Installing Glossy Template"])
